﻿<%@ Page Title="" Language="C#" MasterPageFile="~/AppSpace/Dashboard.Master" AutoEventWireup="true"
    CodeBehind="Users.aspx.cs" Inherits="SmartProject.AppSpace.Users" %>

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="server">
    <cc1:ModalPopupExtender ID="PopUser" runat="server" TargetControlID="BtnAddUser"
        PopupControlID="PnlUser" BackgroundCssClass="modelBackground">
    </cc1:ModalPopupExtender>
    <div id="PnlUser" runat="server" style="display: none; background-color: #EEE">
        <!-- Hidden values for comparison with changed data in edit mode -->
        <input id="PlcFirstName" type="hidden" runat="server" />
        <input id="PlcLastName" type="hidden" runat="server" />
        <input id="PlcUserName" type="hidden" runat="server" />
        <input id="PlcEMail" type="hidden" runat="server" />
        <table width="600px">
            <tr>
                <td>
                    <asp:UpdatePanel ID="UdpUserInfo" runat="server">
                        <ContentTemplate>
                            <table width="100%">
                                <tr>
                                    <td style="color: #EFEFEF; font-weight: bold; font-size: 15px; background-color: #69c;
                                        text-align: left;" colspan="2">
                                        User
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2" align="center">
                                        <asp:Label ID="LblErrorMessage" runat="server" SkinID="ErrorLabel"></asp:Label>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" style="color: Blue">
                                        First Name:
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="TxtFirstName" runat="server" SkinID="StandardTextBox"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" style="color: Blue">
                                        Last Name:
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="TxtLastName" runat="server" SkinID="StandardTextBox" />
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" style="color: Blue">
                                        E-Mail:
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="TxtEMail" runat="server" SkinID="StandardTextBox"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" style="color: Blue">
                                        UserName:
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="TxtUserName" runat="server" SkinID="StandardTextBox"></asp:TextBox><div
                                            class="clean-gray" style="color: #2D9914" runat="server" id="LblUserNameExplain" />
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" style="color: Blue">
                                        Password:
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="TxtPassword" TextMode="Password" runat="server" SkinID="StandardTextBox"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" style="color: Blue">
                                        Verify Password:
                                    </td>
                                    <td align="left">
                                        <asp:TextBox ID="TxtVerifyPassword" TextMode="Password" runat="server" SkinID="StandardTextBox"></asp:TextBox>
                                    </td>
                                </tr>
                                <tr>
                                    <td align="left" style="color: Blue">
                                        Roles:
                                    </td>
                                    <td align="left">
                                        <asp:DropDownList ID="DrpRoles" runat="server">
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                            </table>
                        </ContentTemplate>
                        <Triggers>
                            <asp:AsyncPostBackTrigger ControlID="BtnCancel" />
                        </Triggers>
                    </asp:UpdatePanel>
                </td>
            </tr>
            <tr>
                <td align="right" colspan="2">
                    <asp:ImageButton ID="BtnSave" runat="server" OnClick="BtnSave_Click" ImageUrl="~/Image/WorkSave.png"
                        ToolTip="Save" />&nbsp;&nbsp;&nbsp;&nbsp;
                    <asp:ImageButton ID="BtnCancel" runat="server" ImageUrl="~/Image/WorkCancel2.png"
                        ToolTip="Cancel" OnClick="BtnCancel_Click" />
                </td>
            </tr>
        </table>
    </div>
    <table width="100%">
        <tr>
            <td align="right">
                <asp:ImageButton ID="BtnAddUser" runat="server" ToolTip="New user" ImageUrl="~/Image/Add.png" />
            </td>
        </tr>
        <tr>
            <td>
                <asp:GridView ID="GrvUsers" runat="server" AutoGenerateColumns="False" OnRowCommand="GrvUsers_RowCommand"
                    OnRowEditing="GrvUsers_RowEditing" CellPadding="4" ForeColor="#333333" GridLines="None"
                    Width="100%">
                    <RowStyle BackColor="#EFF3FB" />
                    <Columns>
                        <asp:TemplateField>
                            <ItemTemplate>
                                <img alt="" src="../Image/Users.png" />
                                <input id="PlcUserId" value='<%#Eval("UserId") %>' runat="server" type="hidden" />
                                <input id="PlcUserName" value='<%#Eval("UserName") %>' runat="server" type="hidden" />
                            </ItemTemplate>
                        </asp:TemplateField>
                        <asp:BoundField DataField="FirstName" HeaderText="First name" />
                        <asp:BoundField DataField="LastName" HeaderText="Lastname" />
                        <asp:BoundField DataField="Username" HeaderText="Username" />
                        <asp:BoundField DataField="EMail" HeaderText="E-mail address" />
                        <asp:ButtonField ButtonType="Image" ImageUrl="~/Image/Edit.png" CommandName="Edit"
                            Text="Edit" />
                        <asp:ButtonField ButtonType="Image" ImageUrl="~/Image/Remove.png" CommandName="Remove"
                            Text="Remove" />
                    </Columns>
                    <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                    <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                    <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                    <EditRowStyle BackColor="#2461BF" />
                    <AlternatingRowStyle BackColor="White" />
                </asp:GridView>
            </td>
        </tr>
    </table>
</asp:Content>
